<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="alternate" href="/atom.xml" title="AiChery" type="application/atom+xml">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.5.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="作者认为CNN中信息流被约束在 local neighborhood regions，限制了复杂场景的理解。因此提出了 point-wise spatial attention network (PSANet) 来缓和这种  local neighborhood constraint。通过 self-adaptively learned attention mask，将feature map 中">
<meta name="keywords" content="attention">
<meta property="og:type" content="article">
<meta property="og:title" content="PSANet 笔记">
<meta property="og:url" content="http:&#x2F;&#x2F;yoursite.com&#x2F;2019&#x2F;11&#x2F;11&#x2F;PSANet%20%E7%AC%94%E8%AE%B0&#x2F;index.html">
<meta property="og:site_name" content="AiChery">
<meta property="og:description" content="作者认为CNN中信息流被约束在 local neighborhood regions，限制了复杂场景的理解。因此提出了 point-wise spatial attention network (PSANet) 来缓和这种  local neighborhood constraint。通过 self-adaptively learned attention mask，将feature map 中">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https:&#x2F;&#x2F;blog-1253296122.cos.ap-chengdu.myqcloud.com&#x2F;attention_13.png">
<meta property="og:image" content="https:&#x2F;&#x2F;blog-1253296122.cos.ap-chengdu.myqcloud.com&#x2F;attention_14.png">
<meta property="og:image" content="https:&#x2F;&#x2F;blog-1253296122.cos.ap-chengdu.myqcloud.com&#x2F;attention_13.png">
<meta property="og:updated_time" content="2019-11-11T14:40:20.237Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https:&#x2F;&#x2F;blog-1253296122.cos.ap-chengdu.myqcloud.com&#x2F;attention_13.png">

<link rel="canonical" href="http://yoursite.com/2019/11/11/PSANet%20%E7%AC%94%E8%AE%B0/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>PSANet 笔记 | AiChery</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">AiChery</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">Life is about waiting for the right moment to act.</p>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-简历">

    <a href="/Resume/" rel="section"><i class="fa fa-fw fa-th"></i>简历</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/11/11/PSANet%20%E7%AC%94%E8%AE%B0/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/avatar.jpg">
      <meta itemprop="name" content="Wei Cheney">
      <meta itemprop="description" content="谦谦君子，温润如玉">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="AiChery">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          PSANet 笔记
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2019-11-11 16:37:44 / 修改时间：22:40:20" itemprop="dateCreated datePublished" datetime="2019-11-11T16:37:44+08:00">2019-11-11</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89/" itemprop="url" rel="index">
                    <span itemprop="name">计算机视觉</span>
                  </a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><img src="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/attention_13.png" alt=""></p>
<p>作者认为CNN中信息流被约束在 local neighborhood regions，限制了复杂场景的理解。因此提出了 point-wise spatial attention network (PSANet) 来缓和这种  local neighborhood constraint。通过 self-adaptively learned attention mask，将feature map 中的每个位置与其余位置联系起来。此外，还能够进行双向信息传播以进行 scene parsing。可以收集其他位置的信息以帮助预测当前位置，反之亦然，可以分发当前位置的信息以辅助预测其他位置。</p>
<a id="more"></a>
<p>ECCV2018的文章：</p>
<p><a href="https://hszhao.github.io/papers/eccv18_psanet.pdf" target="_blank" rel="noopener">论文地址</a></p>
<p><a href="https://github.com/hszhao/semseg" target="_blank" rel="noopener">代码PyTorch</a></p>
<p>通过 PSA 学习到的 masks 是自适应的，对位置和类别信息很敏感。</p>
<p>为了捕获 contextual information，尤其是 long range 的， information aggregation对于场景解析非常重要，如Parsenet，Deeplab，PSPNet，Reseg等网络结构。在本文中，作者将 information aggregation 视为一种 information flow，并提出对每个 position 自适应地学习 pixel-wise global attention map，才能够 2 个角度 aggregate contextual information.</p>
<script type="math/tex; mode=display">
\textbf z_i = \frac{1}{N} \sum_{\forall j \in \Omega {i}}F(\textbf x_i,\textbf x_j,\Delta_{ij}) \textbf x_j   \tag{1}</script><ul>
<li>$\textbf z_i$:  the newly aggregated feature at position $i$.</li>
<li>$\textbf x_i$:  featurer epresentation at position $i$ in the input feature map.</li>
<li>$\forall j \in \Omega {i}$: enumeratesa all positions in the region of interest associated with $i$.</li>
<li>$\Delta_{ij}​$: relative location of position $i​$ and $j​$.</li>
<li>$F(\textbf x_i,\textbf x_j,\Delta_{ij})​$:  any function or learnedp arameters according to the operation and it represents the information flow from $j​$ to $i​$.</li>
</ul>
<p>因为考虑了相对位置 $\Delta_{ij}$，$F(\textbf x_i,\textbf x_j,\Delta_{ij})$ 对不用的相对位置是敏感的。可以简化之：</p>
<script type="math/tex; mode=display">
\textbf z_i = \frac{1}{N} \sum_{\forall j \in \Omega {i}}F_{\Delta_{ij}}(\textbf x_i,\textbf x_j) \textbf x_j   \tag{2}</script><ul>
<li>$\{F_{\Delta_{ij}}\}​$:  a set of position-specific functions.</li>
</ul>
<p>建模了从位置 $j​$ 到位置 $i​$ 的信息流。$F_{\Delta_{ij}}(\cdot,\cdot)​$ 的输入包括  source and target information. 当 feature maps中有许多 position 时，组合 $(\textbf x_i,\textbf x_j)​$ 是非常 large 的，因此，作者简化并做了近似。</p>
<p>首先，simplify $F_{\Delta_{ij}}(\cdot,\cdot)$ as</p>
<script type="math/tex; mode=display">
F_{\Delta_{ij}}(\textbf x_i,\textbf x_j) \approx F_{\Delta_{ij}}(\textbf x_i) \tag{3}</script><p>公式（2）可重写为</p>
<script type="math/tex; mode=display">
\textbf z_i = \frac{1}{N} \sum_{\forall j \in \Omega {i}}F_{\Delta_{ij}}(\textbf x_i) \textbf x_j   \tag{4}</script><p>也可以这样简化：</p>
<script type="math/tex; mode=display">
F_{\Delta_{ij}}(\textbf x_i,\textbf x_j) \approx F_{\Delta_{ij}}(\textbf x_j) \tag{5}</script><p>最终可以简化为 bi-direction information propagation path</p>
<script type="math/tex; mode=display">
F_{\Delta_{ij}}(\textbf x_i,\textbf x_j) \approx F_{\Delta_{ij}}(\textbf x_i) +F_{\Delta_{ij}}(\textbf x_j)  \tag{3}</script><p>最终，we model this bi-direction information propagation as</p>
<script type="math/tex; mode=display">
\textbf z_i = \frac{1}{N} \sum_{\forall j \in \Omega {i}}F_{\Delta_{ij}}(\textbf x_i) \textbf x_j  + \frac{1}{N} \sum_{\forall j \in \Omega {i}}F_{\Delta_{ij}}(\textbf x_j) \textbf x_j  \tag{7}</script><p><img src="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/attention_14.png" alt=""></p>
<p>Specifically, our PSA module, aiming to adaptively predict the information flow over the entire feature map, takes all the positions in feature map as $\Omega(i)​$ and  utilizes the convolutional layer as the operation of $F_{\Delta_{ij}}(\textbf x_i)​$ and $F_{\Delta_{ij}}(\textbf x_j)​$. Both $F_{\Delta_{ij}}(\textbf x_i)​$ and $F_{\Delta_{ij}}(\textbf x_j)​$ can then be regarded as predicted attention values<br>to aggregate feature $\textbf x_j​$. We further rewrite Eq. (7) as</p>
<script type="math/tex; mode=display">
\textbf z_i = \frac{1}{N} \sum_{\forall j} \textbf a^c_{i,j} \textbf x_j  + \frac{1}{N} \sum_{\forall j}\textbf a^d_{i,j}\textbf x_j  \tag{8}</script><p>where $\textbf a^c_{i,j}$ and $\textbf a^d_{i,j}$ denote the predicted attention values in the point-wise attention maps $\textbf A^c$ and $\textbf A^d$ from ‘collect’ and ‘distribute’ branches, respectively.</p>
<p><img src="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/attention_13.png" alt=""></p>

    </div>

    
    
    
      
        <div class="reward-container">
  <div></div>
  <button disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/images/wechatpay.png" alt="Wei Cheney 微信支付">
        <p>微信支付</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/alipay.png" alt="Wei Cheney 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/attention/" rel="tag"># attention</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
                <a href="/2019/11/11/Compact%20Generalized%20Non-local%20Network%20%E7%AC%94%E8%AE%B0/" rel="next" title="Compact Generalized Non-local Network 笔记">
                  <i class="fa fa-chevron-left"></i> Compact Generalized Non-local Network 笔记
                </a>
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
                <a href="/2019/11/11/OCNet%20%E7%AC%94%E8%AE%B0/" rel="prev" title="OCNet 笔记">
                  OCNet 笔记 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          
    <div class="comments" id="gitalk-container"></div>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <img class="site-author-image" itemprop="image" alt="Wei Cheney"
    src="https://blog-1253296122.cos.ap-chengdu.myqcloud.com/avatar.jpg">
  <p class="site-author-name" itemprop="name">Wei Cheney</p>
  <div class="site-description" itemprop="description">谦谦君子，温润如玉</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">8</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="feed-link motion-element">
    <a href="/atom.xml" rel="alternate">
      <i class="fa fa-rss"></i>RSS
    </a>
  </div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/chenypic" title="GitHub &amp;rarr; https:&#x2F;&#x2F;github.com&#x2F;chenypic" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="/mailto:cherycheny@gmail.com" title="E-Mail &amp;rarr; mailto:cherycheny@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/2923640394" title="Weibo &amp;rarr; https:&#x2F;&#x2F;weibo.com&#x2F;2923640394" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i>Weibo</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://twitter.com/cherycheny" title="Twitter &amp;rarr; https:&#x2F;&#x2F;twitter.com&#x2F;cherycheny" rel="noopener" target="_blank"><i class="fa fa-fw fa-twitter"></i>Twitter</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Wei Cheney</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v4.0.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> v7.5.0
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>












        
      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>



  
















  

  
      
<script type="text/x-mathjax-config">
    MathJax.Ajax.config.path['mhchem'] = '//cdn.jsdelivr.net/npm/mathjax-mhchem@3';

  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$', '$'], ['\\(', '\\)'] ],
      processEscapes: true,
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
        extensions: ['[mhchem]/mhchem.js'],
      equationNumbers: {
        autoNumber: 'AMS'
      }
    }
  });

  MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() {
    MathJax.InputJax.TeX.prefilterHooks.Add(function(data) {
      if (data.display) {
        var next = data.script.nextSibling;
        while (next && next.nodeName.toLowerCase() === '#text') {
          next = next.nextSibling;
        }
        if (next && next.nodeName.toLowerCase() === 'br') {
          next.parentNode.removeChild(next);
        }
      }
    });
  });

  MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for (i = 0; i < all.length; i += 1) {
      element = document.getElementById(all[i].inputID + '-Frame').parentNode;
      if (element.nodeName.toLowerCase() == 'li') {
        element = element.parentNode;
      }
      element.classList.add('has-jax');
    }
  });
</script>
<script>
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML', () => {
    MathJax.Hub.Typeset();
  }, window.MathJax);
</script>

    

  

<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css">

<script>
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js', () => {
    var gitalk = new Gitalk({
      clientID: 'b518bd54c879c20706b4',
      clientSecret: 'f601dee7ed1d248ae971191226d140acbb9ca107',
      repo: 'PingLun',
      owner: 'chenypic',
      admin: ['chenypic'],
      id: 'e54b226ab6aa7382a5a11a2dea7fd4c5',
        language: '',
      distractionFreeMode: 'true'
    });
    gitalk.render('gitalk-container');
  }, window.Gitalk);
</script>

</body>
</html>
